package com.terracloud.server.dao.sql.device;

import com.terracloud.server.common.data.DeviceGroup;
import com.terracloud.server.dao.model.sql.DeviceGroupEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.UUID;

/**
 *
 * @author chenhainan
 * @since 2025/10/11
 */
public interface DeviceGroupRepository extends JpaRepository<DeviceGroupEntity, UUID>, JpaSpecificationExecutor<DeviceGroupEntity> {

    @Query("select d from DeviceGroupEntity d where d.tenantId = :tenantId and d.id = :deviceGroupId")
    DeviceGroupEntity findDeviceGroupByTenantIdAndId(@Param("tenantId") UUID tenantId,@Param("deviceGroupId") UUID deviceGroupId);
}
